Skip to content

Fix Prism API name: highlightElem -> highlightElement in MutationObserver article#3980

Merged
iliakan merged 1 commit into
javascript-tutorial:masterfrom
Violet-Bora-Lee:fix-prism-highlight-element
Jul 19, 2026
Merged

Fix Prism API name: highlightElem -> highlightElement in MutationObserver article#3980
iliakan merged 1 commit into
javascript-tutorial:masterfrom
Violet-Bora-Lee:fix-prism-highlight-element

Conversation

@Violet-Bora-Lee

Copy link
Copy Markdown
Member

Fixes #3979

The MutationObserver article's prose and inline examples use Prism.highlightElem, which does not exist in the Prism.js API, while the demo code later in the same article correctly uses Prism.highlightElement. This PR unifies all 6 occurrences on the real API name.

It also changes the two forEach(Prism.highlightElement) calls to pass only the element via an arrow function, since forEach supplies (element, index, array) which would collide with the highlightElement(element, async, callback) signature.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MizgRqMWEBSTYhJ9YhSd2g

The article's prose and inline examples use Prism.highlightElem, which
does not exist in the Prism.js API, while the demo code later in the same
article correctly uses Prism.highlightElement. Unify on the real API name.

Also pass only the element in forEach callbacks: forEach supplies
(element, index, array), which would collide with the
highlightElement(element, async, callback) signature if the method
reference is passed directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MizgRqMWEBSTYhJ9YhSd2g
Copilot AI review requested due to automatic review settings July 19, 2026 01:42
@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Jul 19, 2026
@javascript-translate-bot
javascript-translate-bot requested a review from a team July 19, 2026 01:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the MutationObserver tutorial article to consistently reference the correct Prism.js API (Prism.highlightElement) and updates the inline examples so they don’t accidentally pass forEach’s extra arguments into Prism’s highlightElement(element, async, callback) signature.

Changes:

  • Replaced prose references to the non-existent Prism.highlightElem with Prism.highlightElement.
  • Updated inline forEach(Prism.highlightElement)-style calls to forEach(elem => Prism.highlightElement(elem)) so only the element is passed.
  • Kept the article’s demo code and inline examples consistent on the same Prism API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iliakan
iliakan merged commit 725653f into javascript-tutorial:master Jul 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review needed Review needed, please approve or request changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MutationObserver article uses non-existent Prism.highlightElem instead of Prism.highlightElement

4 participants